<template>
    <ul class="contact">
        <li @click="info">
            <router-link to="/"><img src="/img/common/github.png" alt=""></router-link>
        </li>
        <li @click="info">
            <router-link to="/"><img src="/img/common/gitee.png" alt=""></router-link>
        </li>
        <li @click="info">
            <router-link to="/">  <img src="/img/common/bilibili.png" alt=""></router-link>
          </li>
        <li @click="info">
            <router-link to="/"> <img src="/img/common/qq.png" alt=""></router-link>
           </li>
        <li @click="info">
            <router-link to="/">  <img src="/img/common/eamil.png" alt=""></router-link>
          </li>
        <li class="info" >
            <router-link to="/personalInformation">  <img src="/img/common/info.png" alt=""></router-link>
            <span class="message" v-show="message">
                  {{message >99 ? 99 : message}}
            </span>
        </li>
    </ul>
</template>

<script>
import api from "@/api";

export default {
    name: "Contact",
    data(){
        return{
            message:0,
        }
    },
    mounted() {
        let user = JSON.parse(window.localStorage.getItem("user"));
        if(user) {
            api.communicationGetSum().then((res)=>{
                if(res.data.code === 200){
                    this.message = res.data.data;
                }
            })
        }

    },
    watch:{
        message(){
            if(this.message.length!==0){
                this.mes = true;
            }
            else  this.mes = false;
        }
    },
    methods:{
        info(){
            this.$emit("infos")
        }
    }

}
</script>

<style scoped>

.contact{
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 10px;
    border-top: 1px solid #b9b7b7;
    padding: 10px 0;
}
 ul li{
    list-style: none;
    width: 100%
}
.contact li img{
    width: 1.2vw;
}
.info{
    position: relative;
}
.info .message{
    position: absolute;
    right: 0;
    top: -30%;
    content: v-bind(zhi);
    display: inline-block;
    width: 18px;
    height: 18px;
    background: #de0e0e;
    border-radius: 50%;
    text-align: center;
    font-size: 12px;
    color: white;
}
</style>